$(function(){
    obj.init();
});

var obj = new function () {
    'use strict';
    return {
        params: {
            type: null
        },
        dataGrid: null,
        init: function () {
            this.params.type = xhTool.getQuery('type');

            this.dataGrid = new xhDataGrid($('#list'), 'stats_welfare/getWelfare', {type: this.params.type});
            this.dataGrid.parseToolbar().init().activeBtn($('#bt_list_del'));

            this.listener();
        },
        listener: function () {
            var $this = this;
            xhTool.bindDocKeyDown(
                $('#bt_list_search').click(function () {
                    $this.dataGrid.reload({
                        quit: xhExtra.getValue($('#list_quit')),
                        school: xhExtra.getValue($('#list_school')),
                        search: {
                            vague: xhExtra.getValue($('#list_vague'))
                        }
                    });
                })
            );
            //删除
            $('#bt_list_del').click(function() {
                if (xhExtra.buttonDisabled($(this))) return false;
                $this.funObj().delRecord();
            });
        },
        funObj: function(){
            var $this = this;
            return {
                delRecord: function () {
                    xhExtra.askChangeStatus('stats_welfare/delWelfare', {ids: $this.dataGrid.getSelectValues('iSWId')}, $this.dataGrid);
                }
            }
        }
    }
};